home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_Application_JScript.asp < prev    next >
Encoding:
Text File  |  1998-05-29  |  2.0 KB  |  68 lines

  1. <%@ LANGUAGE = JScript %>
  2.  
  3. <!*************************
  4. This sample is provided for educational purposes only. It is not intended to be 
  5. used in a production environment, has not been tested in a production environment, 
  6. and Microsoft will not provide technical support for it. 
  7. *************************>
  8.  
  9. <%
  10.     //Ensure that this page is not cached.
  11.     Response.Expires = 0;
  12. %>
  13.  
  14.  
  15. <HTML>
  16.     <HEAD>
  17.         <TITLE>Using Application Variables</TITLE>
  18.     </HEAD>
  19.  
  20.     <BODY BGCOLOR="White" TOPMARGIN="10" LEFTMARGIN="10">
  21.  
  22.         <!-- Display header. -->
  23.  
  24.         <FONT SIZE="4" FACE="ARIAL, HELVETICA">
  25.         <B>Using Application Variables</B></FONT><BR>
  26.       
  27.         <HR SIZE="1" COLOR="#000000">
  28.  
  29.  
  30.         <%
  31.             //If this is the first time any user has visited
  32.             //the page, initialize Application Value.
  33.  
  34.             if (Application("AppPageCountJScript") == null) 
  35.             {
  36.                 Application("AppPageCountJScript") = 0;
  37.             }
  38.  
  39.  
  40.             //Increment the Application AppPageCount by one.
  41.             //Note that because this AppPageCount value is being
  42.             //shared, locking must be used to prevent 
  43.             //two sessions from simultaneously attempting 
  44.             //to update the value. Don't need if for a single
  45.         // statement. Just an example.
  46.  
  47.             //Application.Lock();
  48.             Application("AppPageCountJScript") = Application("AppPageCountJScript") + 1;
  49.             //Application.UnLock();
  50.         %>
  51.  
  52.  
  53.         <!-- Output the Application Page Counter value. -->
  54.         <!-- Note that locking does not need to be used -->
  55.         <!-- because the value is not being changed by -->
  56.         <!-- this user session. -->
  57.  
  58.         Users have visited this page 
  59.         <%= Application("AppPageCountJScript") %> times!
  60.  
  61.  
  62.         <!-- Provide a link to revisit the page. -->
  63.  
  64.         <P><A HREF="Application_JScript.asp">Click here to visit it again.</A>
  65.  
  66.     </BODY>
  67. </HTML>
  68.